<?php echo module_open(); ?>
<tr>
    <?php if ($GLOBALS['per']['del']) echo '<td class="head center" width="1%"><input type="checkbox" class="checkAll" /></td>'; ?>
	<td class="head center" width="4%"><?php echo create_sort('id') ?>#</td>
	<td class="head" width="6%"><?php echo create_sort('ma') ?>Mã</td>
	<td class="head hide480" width="15%"><?php echo create_sort('ten_nguoimua') ?>Người mua</td>
	<td class="head hide640" width="28%">Địa chỉ</td>
	<td class="head hide640" width="12%"><?php echo create_sort('date_added') ?>Ngày mua</td>
	<td class="head right hide480" width="10%"><?php echo create_sort('tien_thanhtoan') ?>Thành tiền</td>
	<td class="head hide640" width="12%"><?php echo create_sort('status') ?>Tình trạng</td>
	<td class="head center hide640" width="5%">Ghi chú</td>
	<td class="head" width="1%">&nbsp;</td>
</tr>
<?php
if(count($orders) && is_array($orders))
{
	$i = 1;
	foreach ($orders as $row)
	{
?>
<tr class="highlight<?php echo ($row['isnew'] ? ' table-flag-red' : '') ?>" id="<?php echo $row['id'] ?>" name="<?php echo $row['ma'] ?>">
	<?php if ($GLOBALS['per']['del']) echo '<td class="fr center">'.sel_item($row['id']).'</td>'; ?>
	<td class="fr center"><?php echo stt($row['id'], $GLOBALS['var']['rowstart'] + $i++) ?></td>
	<td class="fr"><a title="Chi tiết" href="<?php echo $site_url.'/update/'.$row['id'].$uri_str ?>"><?php echo $row['ma'] ?></a><span class="show480"><br /><?php echo $row['ten_nguoimua'] ?></span></td>
	<td class="fr hide480"><?php echo $row['ten_nguoimua'] ?></td>
	<td class="fr hide640"><?php echo $row['diachi_giaohang'] ?></td>
	<td class="fr hide640" nowrap="nowrap"><?php echo strftime(TIME_STR, strtotime($row['date_added'])) ?></td>
	<td class="fr right hide480"><?php echo number_format($row['tien_thanhtoan']) ?>đ</td>
	<td class="fr hide640"><?php echo $GLOBALS['orders_status'][$row['status']] ?></td>
	<td class="fr hide640" nowrap="nowrap"><textarea class="note_orders" data-field="quantri_ghichu" data-id="<?php echo $row['id'] ?>"><?php echo $row['quantri_ghichu'] ?></textarea></td>
	<td class="fr center" nowrap="nowrap">
		<a title="Bản in" target="_blank" href="<?php echo $site_url.'/printer/'.$row['id'] ?>"><div class="icon glyphicons print"></div></a>
		<a title="Chi tiết" href="<?php echo $site_url.'/update/'.$row['id'].$uri_str ?>"><div class="icon glyphicons list hide480"></div></a>
		<?php if ($GLOBALS['per']['del']) echo del_restore_link($row['id'], $row['deleted']); ?>
	</td>
</tr>
<?php
	}
}
else
{
	echo no_data_mes(10);
}
echo module_close();
?>